/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ru.jSkyRoom.support.recoder;

import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.Map;

/**
 *
 * @author Rakev
 */
public class MapRecoder<K> implements Recoder<Map<K, String>> {
    
    private StringRecoder recoder;

    public MapRecoder(StringRecoder recoder) {
        this.recoder = recoder;
    }

    @Override
    public Map<K,String> recode(Map<K,String> input) throws UnsupportedEncodingException {
        Map<K,String> recodedMap = new HashMap<>();
        for(K key : input.keySet()){
            String value = input.get(key);
            recodedMap.put(key, recoder.recode(value));
        }
        return recodedMap;
    }
    
}
